<template>
<div class="navigation-container">

    <el-row style="positiion:absolute;float:right;line-height:36px;width:40%;padding-top:20px;cursor:pointer;z-index: 9999;" class="logout">
        <el-col :span="22" style="text-align:right"><span style="color:#fff;font-size:18px;cursor: pointer;">欢迎您,{{ name }}</span></el-col>
        <el-col :span="2" style="text-align:center;cursor: pointer;"><img style="height:36px;width:36px;cursor: pointer;" src="../../assets/img/navigation/shutdown.png" @click="LoginOut"></el-col>
    </el-row>

    <el-row>
        <el-col :span="24">
            <div class="navigation-title-container">
                <img src="../../assets/img/navigation/title.png" alt="">
            </div>
        </el-col>
    </el-row>
    <el-row class="row-style1">
        <el-col :span="9">
            <div style="text-align: center">
                <img class="img-yzt" src="../../assets/img/navigation/fhzhyzt-normal.png" alt="" @click="nav(0)">
            </div>
        </el-col>
        <el-col :span="6">
            <div style="text-align: center">
                <img class="img-ygjc" src="../../assets/img/navigation/zhtjzxt-normal.png" alt="" @click="nav(1)">
            </div>
        </el-col>
        <el-col :span="9">
            <div style="text-align: center">
                <img class="img-swszjc" src="../../assets/img/navigation/sjwhzxt-normal.png" alt="">
            </div>
        </el-col>
    </el-row>

    <el-row class="row-style">
        <el-col :span="12">
            <div style="text-align: center">
                <img class="img-yxwh" src="../../assets/img/navigation/ssjkzxt-normal.png" alt="" @click="nav(6)">
            </div>
        </el-col>
        <el-col :span="12">
            <div style="text-align: center">
                <img class="img-zdgc" src="../../assets/img/navigation/yxwhzxt-normal.png" alt="" @click="nav(7)">
            </div>
        </el-col>
    </el-row>
</div>
</template>

<script>
import {
    mapGetters
} from 'vuex'
export default {
    name: 'Login',
    data: function () {
        return {}
    },

    watch: {
        $route: {
            handler: function (route) {
                this.redirect = route.query && route.query.redirect
            },
            immediate: true
        }
    },
    methods: {
        nav(arg) {
            switch (arg) {
                case 0:
                    this.$router.push({
                        path: '/gis/yzt'
                    })
                    break
                case 1:
                    this.$router.push({
                        path: '/gis/ygjc'
                    })
                    break
                case 2:
                    this.$router.push({
                        path: this.redirect || '/gis/yzt'
                    })
                    break
                case 3:
                    this.$router.push({
                        path: this.redirect || '/gis/yzt'
                    })
                    break
                case 4:
                    this.$router.push({
                        path: this.redirect || '/gis/yzt'
                    })
                    break
                case 5:
                    this.$router.push({
                        path: this.redirect || '/gis/yzt'
                    })
                    break
                case 6:
                    this.$router.push({
                        path: '/gis/yxwh'
                    })
                    break
                case 7:
                    this.$router.push({
                        path: '/gis/yxwh'
                    })
                    break
                default:
                    break
            }
        },

        async LoginOut() {
            this.$confirm('此操作将退出系统, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(async () => {
                await this.$store.dispatch('user/LogOut')
                this.$router.push(`/login?redirect=${this.$route.fullPath}`)
            }).catch(e => {

            })
        }
    },
    computed: {
        ...mapGetters(['name'])
    }
}
</script>

<style lang="scss">
.navigation-container {
    background-image: url('../../assets/img/navigation/bg.jpg');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 100%;
}

.img-yzt:hover {
    content: url('../../assets/img/navigation/fhzhyzt-active.png');
    cursor: pointer;
}

.img-ygjc:hover {
    content: url('../../assets/img/navigation/zhtjzxt-active.png');
    cursor: pointer;
}

.img-swszjc:hover {
    content: url('../../assets/img/navigation/sjwhzxt-active.png');
    cursor: pointer;
}

.img-yxwh:hover {
    content: url('../../assets/img/navigation/ssjkzxt-active.png');
    cursor: pointer;
}

.img-zdgc:hover {
    content: url('../../assets/img/navigation/yxwhzxt-active.png');
    cursor: pointer;
}
</style><style lang="scss" scoped>
.navigation-title-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    height: 30px;
    text-align: center;
    line-height: 30px;
}

.row-style1 {
    margin: 120px 0 20px 0;
}

.row-style {
    margin: 10px 0;
}

.logout:hover {
    cursor: pointer;

}
</style>
